from apps.common.base.serializers import *
from apps.merchant.cate.models import *


class CateBaseSerializer(BaseSerializer):
    class Meta:
        model = Cate
        fields = "__all__"


class CateModelSerializer(BaseSerializer):

    lesseeModel = serializers.SerializerMethodField()
    def get_lesseeModel(self, obj):
        try:
            return {'id': obj.lessee.id, 'name': obj.lessee.name}
        except:
            return {}

    class Meta:
        model = Cate
        fields = "__all__"
